Editor

fun Editor(license: String? = null, userId: String? = null, baseUri: Uri = defaultBaseUri, host: String = "", engineRenderTarget: EngineRenderTarget = EngineRenderTarget.SURFACE_VIEW, uiMode: EditorUiMode = EditorUiMode.SYSTEM, configuration: ScopedProperty<EditorScope, EditorConfiguration> = { EditorConfiguration.remember() }, onClose: (Throwable?) -> Unit = {})

Built to provide versatile photo and video editing capabilities. Toggling between edit, preview and pages modes enables users to evaluate their edited photos/videos before export.

Parameters

license

the license to activate the ly.img.engine.Engine with.

userId

an optional unique ID tied to your application's user. This helps us accurately calculate monthly active users (MAU). Especially useful when one person uses the app on multiple devices with a sign-in feature, ensuring they're counted once. Providing this aids in better data accuracy.

baseUri

the base Uri that is used to construct absolute paths from relative paths. absolutePath = baseUri + relativePath. For instance, baseUri can be set to android assets: file:///android_asset/. After setting this path you can, for instance, load example.scene from assets/scenes folder using relative path: engine.scene.load(sceneUri = Uri.parse("scenes/example.scene")) Default value is defaultBaseUri.

engineRenderTarget

the target which should be used by the ly.img.engine.Engine to render. Default value is EngineRenderTarget.SURFACE_VIEW.

configuration

the configuration object of the editor. Check EditorConfiguration.Companion.remember documentation on how to create and configure the object. Note that this parameter is optional. The default behavior is specified in EditorConfiguration.Companion.remember. IMPORTANT: EditorConfiguration should only be created inside configuration composable lambda, otherwise crashes may occur.

onClose

the callback that is invoked when the editor is closed. Here are some of the recommended implementations:

  1. activity.finish() if the editor is launched in a standalone activity.

  2. fragmentManager.popBackStack() if the editor is launched in a fragment.

  3. navController.popBackStack() if the editor is launched as a new composable destination in NavHost. If the optional parameter Throwable is not null, it means that the editor is closed due to an error. The value is propagated from ly.img.editor.core.event.EditorEvent.CloseEditor. Unless custom types are sent to this function, the throwable is always going to be either an EditorException or ly.img.engine.EngineException.